Infer default source/backtrace fields#65
Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
masterror/masterror-derive/src/input.rs
Lines 208 to 218 in 48fc630
[P1] Restrict backtrace inference to std::backtrace::Backtrace
The new inference treats any field whose type name ends with Backtrace as a backtrace (even when it comes from another crate). If a project defines struct Error { trace: other_crate::Backtrace } without any attributes, the derive now generates a fn backtrace(&self) -> Option<&std::backtrace::Backtrace> and tries to return &self.trace, which does not type‑check because other_crate::Backtrace is unrelated to std::backtrace::Backtrace. This behaviour is a regression from the previous release (where such fields were ignored unless explicitly annotated) and will break existing users that rely on custom Backtrace types. Consider verifying the full path is std::backtrace::Backtrace/Option<std::backtrace::Backtrace> before setting inferred_backtrace.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
Summary
FieldAttrsmetadata for unannotatedsourceandBacktracemembers so the derive matchesthiserrorhas_source/has_backtraceflags instead of raw attributes#[source]/#[backtrace]Testing
https://chatgpt.com/codex/tasks/task_e_68ccf855ef10832baf1cd8aee6264f3f